﻿using DevExpress.ExpressApp.DC;
using EasyXaf.LowCode.WorkflowEditors.Models;
using System.Xml.Linq;

namespace EasyXaf.Sample.Module.BusinessObjects;

[DomainComponent]
public class JsonObjectProperty : FlowObject
{
    public string PropertyName
    {
        get => GetPropertyValue<string>();
        set => SetPropertyValue(value);
    }

    public string PropertyValue
    {
        get => GetPropertyValue<string>();
        set => SetPropertyValue(value);
    }

    public override void WriteStateToXml(XElement element)
    {
        base.WriteStateToXml(element);

        SetXmlValue(element, nameof(PropertyName), PropertyName);
        SetXmlValue(element, nameof(PropertyValue), PropertyValue);
    }

    public override void ReadStateFromXml(XElement element)
    {
        base.ReadStateFromXml(element);

        PropertyName = GetXmlValue<string>(element, nameof(PropertyName));
        PropertyValue = GetXmlValue<string>(element, nameof(PropertyValue));
    }
}
